package sample;

import org.reactivestreams.Subscription;

import reactor.core.publisher.BaseSubscriber;
import reactor.core.publisher.SignalType;

public class SampleSubscriber<T> extends BaseSubscriber<T> {

    public void hookOnSubscribe(Subscription subscription) {
        System.out.println("Subscribed");
        request(1);
    }

    public void hookOnNext(T value) {
        System.out.println("hookOnNext: " + value.toString());
        request(1);
    }

    @Override
    protected void hookOnError(Throwable throwable) {
        System.out.println("hookOnError");
        super.hookOnError(throwable);
    }

    @Override
    protected void hookOnCancel() {
        System.out.println("hookOnCancel");
        super.hookOnCancel();
    }

    @Override
    protected void hookOnComplete() {
        System.out.println("hookOnComplete");
        super.hookOnComplete();
    }

    @Override
    protected void hookFinally(SignalType type) {
        System.out.println("hookFinally");
        super.hookFinally(type);
    }
}
